<?php
    include("./dbconn.php");

    //接收数据
    $user = $_GET["user"];
    $pw = $_GET["pw"];

    //查询用户名是否重复
    $sql = "select * from vip where user='$user'";

    $result = $conn->query($sql);

    if ($result->num_rows > 0){
        //有相同的用户名
        $row = mysqli_fetch_assoc($result);
        if ($pw == $row["pw"]){
            $data["code"] = 2;
            $data["msg"] = "登录成功";
        }else{
            $data["code"] = 0;
            $data["msg"] = "密码错误";
        }
    }else{
        $data["code"] = 1;
        $data["msg"] = "账号错误";
    }
    echo json_encode($data);
   
?>